<?php  
class ControllerModuleyahoochat extends Controller {
	protected function index() {
		$this->language->load('module/yahoochat');

      	$this->data['heading_title'] = $this->language->get('heading_title');
		$this->data['lable_mobile'] = $this->language->get('lable_mobile');	
		$this->data['lable_yahooid'] = $this->language->get('lable_yahooid');
		
		$exp = explode('---',$this->config->get('yahoochat_code'));
		$content = '';

		$str = '';
		if(count($exp) == 0){
			$content = '';
		}
		elseif(count($exp) == 1){
			$str = explode(';',$exp[0]);
			$content .='<b>'.$str[1].'</b><br>			
			<a href="ymsgr:sendim?'.$str[0].'">
			<img src="image/yahoo/online.jpg?id='.$str[0].'&img='.$str[3].'"></a><br>
			'.$this->data['lable_yahooid'].': '.$str[0].'<br>
			'.$this->data['lable_mobile'].': '.$str[2].'
			<br><br>';

		}else{
			for ($i=0; $i<=count($exp)-1;$i++){
				$str = explode(';',$exp[$i]);
				$content .='<b>'.$str[1].'</b><br>			
				<a href="ymsgr:sendim?'.$str[0].'">
				<img src="image/yahoo/online.jpg?id='.$str[0].'&img='.$str[3].'"></a><br>
				'.$this->data['lable_yahooid'].': '.$str[0].'<br>
				'.$this->data['lable_mobile'].': '.$str[2].'
				<br><br>';
				}
		}

		$this->data['code'] = $content;
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/yahoochat.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/yahoochat.tpl';
		} else {
			$this->template = 'default/template/module/yahoochat.tpl';
		}
		
		$this->render();
	}
}
?>